package com.sfc.spiderweb;

import com.sfc.spiderweb.service.AmazonInfoToMysqlService;
import com.sfc.spiderweb.util.OssUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.File;

@RunWith(SpringRunner.class)
@SpringBootTest
public class AmazonInfoToMysql {

    @Autowired
    private AmazonInfoToMysqlService service;

    @Test
    public void amazonTransfer(){
        service.amazonTransfer("2020-04-13");
    }

    @Test
    public void amazonViolationData(){
        service.amazonViolationData("2020-04-13");
    }

    @Test
    public void amazonIndexScreenshot(){
        service.amazonIndexScreenshot("2020-04-13");
    }
    @Test
    public void uploadImg(){
        File file = new File("D:\\oss\\amazon.es7_20200410104032.png");
        OssUtil.uploadFileToOss(file,"spider/amazon_index_screenshot/2020-04-13/amazon.es7_20200410104032.png");
        String url = OssUtil.getUrl("spider/amazon_index_screenshot/2020-04-13/amazon.es7_20200410104032.png");
        System.out.println(url);
    }
}
